package com.itheima.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.OrderSettingService;
import com.itheima.utils.DateUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 定时清理
 */
public class ClearOrderSetting {

    @Reference
    private OrderSettingService orderSettingService;

    public  void delete(){

        try {
            orderSettingService.deleteBeforeDate(DateUtils.parseDate2String(new Date()));
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("5秒清理测试");
    }
}
